<%--
  Created by IntelliJ IDEA.
  User: 28633
  Date: 2021/1/21
  Time: 19:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--导入配置页面--%>
<%@ include file="basePath.jsp"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>忘记密码</title>
    <link type="text/css" rel="stylesheet" href="${basePath}/static/reception/css/password.css" />
    <script type="text/javascript" src="${basePath}/static/reception/js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var height=$(document).height();
            $('.main').css('height',height);
        })
    </script>
</head>

<body>
<div class="main">
    <div class="main0">
        <div class="formBox">
            <form method="post"  id="frm">
            <h3>登录密码重置</h3>
            <ul>
                <li class="mainCol firLi">&gt;身份验证</li>
                <li>&gt;登录密码重置</li>
                <li class="lastLi">&gt;重置完成</li>
            </ul>
            <img src="${basePath}/static/reception/images/line.png" />
            <div class="itembox">
                <label>手机号码&nbsp;:</label>
                <input type="text" name="phone" id="phone" placeholder="请输入注册手机号" onblur="checkPhone()"></span>
            </div>
            <div class="psw">
                <span id="errPhone" style="display:none; color: red" >
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                手机号码有误，请重填</span>
            </div>
            <div class="btnBox">
                <input type="button" onclick="next()" value="下一步"></button>
            </div>
            </form>
        </div>
    </div>
</div>

<div class="footer">
    <div class="footer0">
        <div class="footer_l">使用条款 | 隐私保护</div>
        <div class="footer_r">© 2015 （杭州）金融信息服务有限公司    杭ICP备0000000号</div>
    </div>
</div>
</body>
<script>
    var regPhone = /^1[3456789]\d{9}$/;
    /**
     * 核对手机号码是否正确
     */
    function checkPhone(){
        let phone = document.getElementById('phone').value;
        let errPhone = document.getElementById("errPhone");
        if(regPhone.test(phone)){
            errPhone.style.display = "block";
        } else {
            errPhone.style.display = "none";
        }
        if (!regPhone.test(phone) || !phone) {
            alert("手机号不符合要求");
            return false;
        }
    }

    // 验证手机号是否已经存在
    function next() {
        let phone = document.getElementById('phone').value;
        if (phone) {
            // 电话号码为空，直接跳出
            let errPhone = document.getElementById("errPhone");
            errPhone.style.display = 'block';
            $.post("${basePath}lt_web/checkPhone",{"phone":phone},function (data) {
                // 如果传过来的数据不为空
                console.log(data);
                if (data != null) {
                    if (data == 1){
                        alert("符合要求");
                        window.location.href="${basePath}lt_web/lt_topwd2";
                    }else {
                        alert("该手机用户不存在请完成注册！！！");
                    }
                }
            },'json');
        }
    }

</script>
</html>
